Skip to content

ARTEMIS-6049 mask cluster-password input from CLI#6419

Merged
clebertsuconic merged 1 commit intoapache:mainfrom
jbertram:ARTEMIS-6049
May 8, 2026
Merged

ARTEMIS-6049 mask cluster-password input from CLI#6419
clebertsuconic merged 1 commit intoapache:mainfrom
jbertram:ARTEMIS-6049

Conversation

@jbertram
Copy link
Copy Markdown
Contributor

@jbertram jbertram commented May 6, 2026

No description provided.

@jbertram jbertram force-pushed the ARTEMIS-6049 branch 2 times, most recently from 80fe3e9 to 5b70409 Compare May 6, 2026 02:41
if (clusterPassword == null) {
clusterPassword = inputPassword("--cluster-password", "What is the cluster password?", "password-admin");
try {
clusterPassword = PasswordMaskingUtil.wrap(PasswordMaskingUtil.getDefaultCodec().encode(clusterPassword));
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jbertram I don't understand this.. you're only masking the password if sent through the input..

I think if you did ./artemis create --cluster --password myPassowrd

it should also be masked, right?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

as a matter of fact there are a few smoke tests (e.g. ClsuteredLargeMessageTest) that will use the clustered CLI, and it would be a good test basis.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea. Fixed.

Create.enableInput();
try {
InputReader inputReader = Mockito.mock(InputReader.class);
Mockito.when(inputReader.readPassword(Mockito.anyString())).thenReturn(password);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you should also test when through arguments.. (non masked)..

so it doesn't matter to use the input here.. you could just always mask.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed.

@clebertsuconic clebertsuconic merged commit bae1c1a into apache:main May 8, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants